﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DovizKurlari();
    }
    public void DovizKurlari()
    {
        try
        {
            XmlTextReader okuyucu = new XmlTextReader("http://www.tcmb.gov.tr/kurlar/today.xml");
            XmlDocument dokuman = new XmlDocument();
            dokuman.Load(okuyucu);
            XmlNode dolar = dokuman.SelectSingleNode("/Tarih_Date/Currency[CurrencyName='US DOLLAR']");
            XmlNode euro = dokuman.SelectSingleNode("/Tarih_Date/Currency[CurrencyName='EURO']");
            lblDolarAlis.Text = dolar.ChildNodes[3].InnerText;
            lblDolarSatis.Text = dolar.ChildNodes[4].InnerText;
            lblEuroAlis.Text = euro.ChildNodes[3].InnerText;
            lblEuroSatis.Text = euro.ChildNodes[4].InnerText;
        }
        catch (Exception)
        {
            lblDolarAlis.Text = "";
            lblDolarSatis.Text = "";
            lblEuroAlis.Text = "";
            lblEuroSatis.Text = "";
        }
    }
}